﻿<%@ Page Language="C#" MasterPageFile="../Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Microsoft.Web.Mvc"%>
<asp:Content ID="indexHead" ContentPlaceHolderID="head" runat="server">
    <title>Admin</title>
</asp:Content>

<asp:Content ID="css_js" ContentPlaceHolderID="js_css" runat="server">
</asp:Content>

<asp:Content ID="head_content" ContentPlaceHolderID="head_content" runat="server">
      <% Html.RenderAction("index","head"); %>
</asp:Content>

<asp:Content ID="indexContentRight" ContentPlaceHolderID="main_content" runat="server">
  <div class="breadcrumb">
    <a href="/admin/home/index">Trang Chủ</a>:: <a href=""> Thay đổi mật khẩu</a>
</div>
<% if (ViewData["success"] != null)
   { %>
<div class="success"><%= Html.Encode(ViewData["success"])%></div>
<%} %>
<% if (ViewData["error"] != null)
   { %>
<div class="warning"><%= Html.Encode(ViewData["error"])%></div>
<%} %>

<div class="box">
  <div class="left"></div>
  <div class="right"></div>
  <div class="heading">
    <h1 style="background-image: url('/admin/content/images/user.png');">Thay đổi mật khẩu</h1>
    <div class="buttons"><a onclick="check_validate()" class="button"><span>Sửa</span></a><a onclick="location = '/admin/account/changepassword';" class="button"><span>Huỷ bỏ</span></a></div>
  </div>
  <div class="content">
    <form action="/admin/account/changepassword" method="post" id="change" name="change">          
      <table class="form">
        <tbody>
        <tr>
          <td><span class="required">*</span> Tên đăng nhập:</td>
          <td><%= Html.Encode(ViewData["user_name"])%></td>
        </tr>
        <tr>
          <td>Mật khẩu cũ:</td>
          <td><input name="old_password" id="old_password" value="" size="50" type="password" maxlength="20"/></td>
        </tr>		
        <tr>
          <td>Mật khẩu mới:</td>
          <td><input name="new_password" id="new_password" value="" size="50" type="password" maxlength="20"/>
            </td>
        </tr>
        <tr>
          <td>Nhập lại mật khẩu mới:</td>
          <td><input name="confirm_new_password" id="confirm_new_password" value="" size="50" type="password" maxlength="20"/>
            </td>
        </tr>

      </tbody></table>
    </form>
  </div>
</div>
<script type="text/javascript">
    function check_validate() {
        if (document.getElementById("old_password").value == "") {
            alert('Vui lòng nhập tên mật khẩu cũ');
            document.getElementById("old_password").focus();
            return false;
        }
        else if (document.getElementById("new_password").value == "") {
            alert('Vui lòng nhập mật khẩu mới');
            document.getElementById("new_password").focus();
            return false;
        }
        else if (document.getElementById("new_password").value.length < 6) {
            alert('mật khẩu phải dài hơn 6 kí tự');
            document.getElementById("new_password").focus();
            return false;
        }
        else if (document.getElementById("confirm_new_password").value == "" || document.getElementById("new_password").value != document.getElementById("confirm_new_password").value) {
            alert('Mật khẩu mới nhập lại không giống');
            document.getElementById("confirm_new_password").focus();
            return false;
        }
        else {

            $('#change').submit();
        }

    }
 </script>
            
</asp:Content>
